perm filename ETVBUG.DON[E,ALS]1 blob sn#266413 filedate 1977-03-03 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin "MATRIX MANIPULATOR"
C00006 ENDMK
C⊗;
begin "MATRIX MANIPULATOR"

comment	This program maintains the files containing the debt-matrix.;

require "{}<>" delimiters;

define	⊂ = {begin},
	⊃ = {end},
	thru = {step 1 until},
	↓ = {'15&'12},
	! = {comment};

!	First things first.  The following 2 values determine the maximum capacity
	of the program.  MT = max # people actually in the matrix, NM = max # people
	whose names can be known to the program.  Should one of these parameters be
	exceeded (as indicated by an appropriate error message), the program will
	have to be recompiled.;

define	MT = {20},	NM = {50};

define	matppn = {"MATDON"},
	infinity = {'377777777777},
	everyone = {OWEDTO, true};	! (useful sometimes for calling `report');

integer RAND, NEWSTUFF, SCREW, WHO, AMOUNT, I, J;	string OKAY, WHY, OLDWHY;
integer array MAT[1:MT,1:MT], OWEDTO, OWING, POSN[0:NM+1], SEEN[1:NM,1:2], RCD[1:10];

!	Variable	Purpose
	========	=======================
	RAND		Current random number seed
	NEWSTUFF	Set to true if anything new is added
	SCREW		Set to true, then made false unless entry is aborted
	WHO		Index in NAMES of current user
	AMOUNT		Amount of debt (all amounts are in pennies)
	I, J		Random handy integers

	OKAY		Reply to question, usually a yes/no type
	WHY		Explanation for this debt
	OLDWHY		Expl. for previous debt (for ditto-ing)

	MAT		[i,j] is amount owed by NAMES[i] to NAMES[j]
	OWEDTO, OWING	Temporary sets of names, entries are indices into NAMES
			[0] = number of entries used, or = -1 for null-input case
	POSN		[i] = index in MAT for NAMES[i], or = 0 if balanced out
	SEEN		[i,*] = date/time of last run by NAMES[i]
	RCD		Single record in audit data, format:
			[1], [2] = date, time
			[3] = who entered it, who owed, whom owed to (12 bits each)
			[4] = amount
			[5] etc = explanation (up to 30 chars)

The following macros will be useful mnemonics when using RCD and name-sets.;

define	Rdate = {1},	Rtime = {2},	Rpeople = {3},
	Ramt = {4},	Rexpl = {5},	number (NAMELIST) = NAMELIST[0];

The following are yoyo's which will be used.;

define	date = {call (0, "date")},
	timer = {call (0, "timer")},
	getppn = {call (0, "getppn")},
	setnam (NAME) = {call (cvsix (NAME), "setnam")},
	namein (NAME) = {call (cvsix (NAME), "namein")},
	sleep (K) = {call (K, "sleep")},
	exit = {call (1, "exit")};	! Note that files are not automatically closed;

external integer _skip_;	! For detecting whether the namein yoyo skips;